package com.lagou.controller;

import com.lagou.service.VertifyCodeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: VertifyCodeController
 * @Auther: Jerry
 * @Date: 2020/10/22 16:41
 * @Desctiption: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/code")
public class VertifyCodeController {

    @Reference
    private VertifyCodeService codeService;

    @RequestMapping("/create/{email}")
    public Boolean create(@PathVariable("email") String email) {
        return codeService.create(email);
    }

    @RequestMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable("email") String email,
                            @PathVariable("code") String code) {
        return codeService.validate(email, code);
    }

}
